Camera free look, without affecting pawn's yaw rotation.

Hey guys, I need some help.
I’m currently working on a game set in space, and the pawn is a spaceship. The movement is keyboard based, and when holding right click, the player can free look. When you press the A and D keys, the pawn doesn’t go left or right, but rather turn on the yaw axis.
The problem is that when panning the camera, if you want to look left you move your mouse left, and the pawn calls the AddControllerYawInput function to add the yaw rotation. That is the same function I use to turn the pawn (when A or D is pressed).
When in free look, you don’t want to rotate the pawn along with the camera. But when you turn the pawn you want. That is why the bUseControllerRotationYaw checkbox needs to be checked.
So what do I do?
(Note: I’m working with UE 4.27)