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

If you want your class to be initialized on the start of the game(mode), you can simply write a function (override) BeginPlay and EndPlay on your gamemode class, then initialize/deinitialize your class out of this functions.