auto player1 = Cast(NewPlayer);
Thats the right way =)
Did you try to Call any AMyPlayerController specific Function? Because C++ type Casting will not return you a nullptr if it fails and will crash on you if you try todo something with it.
You most likely dont get a AMyPlayerController there. Can you do a quick Log like that:
UE_LOG(LogTemp, Warning, TEXT("MyClass is %s : "), *NewPlayer->GetPathName());
Edit: Sry used the Protected Function fixed now