Access parent variables and functions through component c++

Hey man i need to ask this…
Lets say if i put that in my BeginPlay()

MySpawnerActor* parentSpawner = (MySpawnerActor*)this->GetOwner();

How would i use it in my other functions ?

void SomeFunction::DoSomething(){
parentSpawner->DosomeMethodB();
}

Cause it seems to not be public among the entire .cpp cause it keeps telling me it is undefined in my other function…

So i actually tried to put it in my .header file

MySpawnerActor* parentSpawner;

I seem to be not understanding something here. Need help on this.
Anyways thanks for being so helpful this far !