You can use a revolute joint to rotate two bodies about a common axis.
An example of a revolute joint is a door hinge.