rotation of an object

How do I allow a variable to save the rotation of the object the script is attached to and the rotation of an object that is classified as a transform variable

I have tried to save it in a Vector3 variable but it displays an error

Transform.rotation is of type Quaternion:

Quaternion rotation = transform.rotation;