OnOverlap delegate already keeps other actor in function variables.
For that purpose you should do.
MainSphere->OnComponentBeginOverlap.AddDynamic(this, &AClassName::FunctionName);
Here is the definition of ComponentOverlap in PrimitiveComponent.h
DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SixParams( FComponentBeginOverlapSignature, UPrimitiveComponent, OnComponentBeginOverlap, UPrimitiveComponent*, OverlappedComponent, AActor*, OtherActor, UPrimitiveComponent*, OtherComp, int32, OtherBodyIndex, bool, bFromSweep, const FHitResult &,SweepResult);
Based on above signature macro your function (imagining its Actor) you should have function like this :
void AClassName::FunctionName(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
{
if (OtherActor != nullptr)
{
AActor myActor = Cast<AYourPlayerClass>(OtherActor);
if (myActor)
myActor->DoSomething()
}
}
At here other actor is the actor actually overlapping with this actor. So you will cast it to your main character.
If you have further questions dont hesitate to ask me.