How i can equal 2 Tranform Rotations?

I need to equal 2 Rotations
Object A: X = 45º Y = 0 Z = 0
I need Object B to be equal to this

I tried this:

Quaternion tempRot = this.transform.rotation;
//In this case the Object B spins very fast.

and this

shipRotInd.rotation = this.transform.rotation;
//In this case de Object B goes X = 270º for no reason

If Transform.rotation sets the global rotation (relative to the world) while inspector displays local rotation (relative to the objects. parent). So if

shipRotInd.rotation = this.transform.rotation;

is not setting the rotations to be the same then most likely they have parents with different rotations but their rotations (in terms of the world) are still the same

If you want to set the local rotations to be the same (this would also set the rotations displayed by the inspector to be the same) use Transfrom.localRotation

shipRotInd.localRotation = this.transform.localRotation;