in 2 particles system, the Hamiltonian is formed by 2 Hilbert spaces, such that:

H=H_1 \otimes H_2

for example:

H= \frac{P_1^2}{2m_1} +\frac{P_2^2}{2m_2}

however, it can also be expressed in center of mass – Hilbert space and relative -Hilbert space:

H=H_{cm}\otimes H_{rel}

since this is just another factorization, the 2 spaces are still independence. In practice, we have to define position vector for center of mass and relative position:

\bar{X} = \frac{m_1X_1+m_2 X_2}{m_1+m_2}

X = X_1 - X_2

the corresponding momentum are:

\bar{P} = P_1+P_2

P = \frac{m_2 P_1 - m_1 P_2}{m_1+m_2}

with relations:

\bar{P} = (m_1+m_2)\dot{\bar{X}}=M\dot{\bar{X}}

P = \frac{m_1 m_2}{m_1+m_2} \dot{X} = m \dot{X}

thus, the example Hamiltonian becomes:

H = \frac{\bar{P}^2}{2M} + \frac{P^2}{2m}

since the total momentum \bar{P} is just a translation motion of the system, we can safely omit it in most cases and this reduced the 2 body system into 1 body system with fixed center.