Why GetAllActorsOfClass returns empty?

I have a PlayerControl.cpp which derives from Pawn class

In that class , I have a method to get all Actors in Map

	TSubclassOf<AEnemy> ClassToFind;
	TArray<AActor*> FoundEnemies;
	UGameplayStatics::GetAllActorsOfClass(GetWorld(), ClassToFind, FoundEnemies);

But FoundEnemies array is always empty , When I do the same thing in BP it works.

Can someone tell me why is this not working in C++ ?
Or If I am doing wrong , How to do it correct ?

It doesn’t seem like you’re assigning a value to the variable ClassToFind.

ClassToFind = AEnemy::StaticClass();

Thanks for the answer, I’ll try what you suggested : )