Wait, are you using OnActorBeginOverlap or OnComponentBeginOverlap? If you use OnActorBeginOverlap then the function you add to this event should have signature
void function(class AActor* OtherActor)
but if you use OnComponentBeginOverlap then it’ll be
void function(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)