how to call a function from c++ class that is not an Actor

You have to instantiate the class first. It doesn’t call BeginPlay() because it isn’t spawned in a world, unlike Actors which are specifically for existing in a world.

Instantiate your class from somewhere (like in the GameMode) and then invoke whatever function you like from said class.