Becoming desperate with rotators :'(

Hi everyone,

since two days I am struggling with animating a look at rotator.
I have a two scene components A and B. B is moving around A and A has a mesh parented onto it, so that the mesh is looking to B.

A and B are moving only in two dimensions (y, z). Everything looks cool as long as B is in further away in the y axis, but when A is in front of B in the y-axis my mesh flips.

I am also printing my rotation vector of A. When everything works it is 90 in yaw, but when when the are both in the same y-axis position the yaw rotation flips to -90.

I tried clamping the rotation or adding a second rotator, but nothing worked.

Is there anyone who could explain me how the rotation works, so I could solve my problem here?

Greetings
Evil_Fischi