making a compass from c++ ?

Hi guys

This is my first forum post, so go easy on me if I failed to follow any conventions.
I wanted to know if anyone can point me at a tutorial vid or otherwise that teaches how to make a compass through scripting.
There are tons that uses blueprints but I have yet to find any that shows how to script one through c++. The reason I ask this is because we are trying to train an AI and we need it to be able to tell the player’s orientation from a compass.
If anyone has any other advice I would love to hear it. I have implemented a blueprint compass but our team is not sure how we can access that information for the AI which is an outside entity right now in its training phase.

I’m garbage at scripting from scratch but it has fallen down to me while the others try to figure out machine learning.
So a step by step guide will be great ^_^.