Cant call function from AActor

I cant call the function from an actor in the following code

TArray<AActor*> EnemySpawners;

UGameplayStatics::GetAllActorsWithTag(GetWorld(), FName(TEXT("Spawner")), EnemySpawners);

for (AActor* Spawner : EnemySpawners)

Keeps saying it is not member…

Tried making array of the class AEnemySpawner, but GetAllActorsWithTag only returns AActors

GetAllActorsOfClass also returns AActor… cant call stuff from AEnemySpawner with it…

If Casting is the solution I can not figure out how to do it…

Pleas help

Finally got it to work when using GetAllActorsOfClass and then properly casting it in the loop