A Hopf differential for constant mean curvature surfaces inS2×R andH2×R