Copy Retarget Base Pose

I want to play Unreal’s animations on my own character. For this, I did the bone retargeting. But for the animation looking good, I also need to adjust the base pose of my own character since it is in t-pose, while the Unreal mannequin is in a-pose. To get the exact same base pose I wanted to do this in C++ because I thought I could just get the values for every bone of the Unreal mannequin and than overwrite the base pose of my own character with this.

My problem now is that the coordinate systems of the bones are totally different:

While the coordinate systems of the bones of my own character seem to be world aligned, the ones for the Unreal mannequin seem to be locally aligned to the bones and in addition rotated for different groups of bones (e.g. Z is phasing up for the left arm but sidewards for the legs).

I tried to make a coordinate system transformation by switching the coordinates for e.g. Y and Z but I am not sure if this is really the solution since the coordinate systems are additionally aligned differently.

Does anyone maybe have a hint for me for how to achieve that both characters in the end have the same base pose?