Play animation from component C++

How do I play an anim montage on my character from a component that is attached to them in C++?

Do I need to get a reference of the owner and try and cast to them? Not sure how the syntax is supposed to look like.

//.h file
UAnimMontage* WalkRunMontage;
bool bLoop;

//.cpp file
YourCharacter->GetMesh()->PlayAnimation(WalkRunMontage, bLoop)

If anybody is still looking for answer