How to Set the Actor rotation to Yaw in C++?

This is also a good set of logics, but mine is different and I have it working, the problem is the pitch value stops updating at 90 degrees due to Gimbal Lock.
I can only pass this if I will manage to set the actor.Yaw from controller.Yaw as shown in the image above.
In blueprint I can set it and in C++ I have no Idea about it.