SetOwner in C++

Sure, if each of the headers has classes containing members of each other, then that is impossible. And unless you have forward declarations then things can still break. In general having forward declarations in headers instead of includes is best practice (where possible).

Your setup should be something like this, Redemp:

BaseCharacter.h:

#pragma once

#include "GameFramework/Character.h"

class ABaseWeapon;

UCLASS()
class ABaseCharacter : public ACharacter
{
	GENERATED_BODY()

public:

	UPROPERTY()
	ABaseWeapon* MyWeapon;

};

BaseWeapon.h:

#pragma once

#include "GameFramework/Actor.h"

class ABaseCharacter;

UCLASS()
class ABaseWeapon : public AActor
{
	GENERATED_BODY()

public:

	void SetOwningPawn(ABaseCharacter* NewOwner);

	ABaseCharacter* MyPawn = nullptr;

};

BaseWeapon.cpp:

#include "BaseWeapon.h"
#include "BaseCharacter.h"

void ABaseWeapon::SetOwningPawn(ABaseCharacter* NewOwner)
{
	if (MyPawn != NewOwner)
	{
		Instigator	= NewOwner;
		MyPawn		= NewOwner;
		// net owner for RPC calls
		SetOwner(NewOwner);
	}
}