I am more comfortable working with direction cosine matrices, so the way I would do this is to first convert the quaternions to DCM's;
Assume Quaternion A represents the orientation of body A in the I frame
Quaternion B represents the orientation of Body B in the I frame.
The direction cosine matrix, C, that transforms from I to A is defined as:
If the Quaternion is defined as [a, b, c, d], (where a is the scalar part and b, c, d is the vector part) then the direction cosine matrix in terms of the quaternion is
So, first compute the direction cosine matrix from quaternion A (DCMA) and from quaternion B (DCMB).
Now the direction cosine matrix for the transformation from A to B is
DCMAB = DCMB * transpose(DCMA).
Now that you have the transformation matrix from A to B, you can get the Euler angles or rotation vector from this DCM.
Using DCMAB, this gives the rotation vector from A to B.