How do I transform two objects to the same frame of reference
As suggested by @MarkusvonBroady. I positioned both objects in the desired starting position. Then I selected both objects and pressed Ctrl + A, and then selected Apply all transforms. After that, the objects both had the same frame of reference, same angles of rotation etc.
We can also select individual transforms to apply, for example, we could just apply rotation.