New to C++: Trouble with refering to a class. Classes are "undefined"

I posted this problem a couple of minutes ago, but it did not show up on the board so I am trying again. If my question is posted and this is a duplicate I apologise in advance!

This problem may seem perfectly basic, but I just cannot seem to make it work. I’m very new to C++ and UE and I’ve just started to look at the code for the Top Down template and am currently trying to modify the code for moving to a clicked destination. Instead, I am trying to have the player only move to a destination if there is an instance of the class ATarget where the cursor is clicked. Here is the function from PlayerController.cpp which I’m trying to change:

void ATurnBasedBattlePlayerController::MoveToMouseCursor()
{
	// Trace to see what is under the mouse cursor
	FHitResult Hit;
	GetHitResultUnderCursor(ECC_Visibility, false, Hit);
	

	if (Hit.Actor != nullptr) // Making sure that what was under the cursor is an Actor
	{	
		
		if (Hit.Actor->IsA(ATarget::StaticClass()) // Check if the Actor is of class Target
		{
			// We hit something, move there
			SetNewMoveDestination(Hit.ImpactPoint);
		}
	}

	
}

ATarget inherits from AActor and I have a forward declaration in PlayerController.h class ATarget* MoveToTarget.
IntelliSense is giving me a squiggly line under ATarget::StaticClass() saying “Incomplete type is not allowed” and compiling gives me the error C2027: use of undefined type ‘ATarget’. So how do I clearly define my ATarget class so that other classes can “see” it?
Secondly, the Actor variable from the Hit struct is a TWeakObjectPtr, which I’m not entirely sure of how to dereference or if it’s at all neccessary.

Never mind! I solved it. ^^