A splitting theorem for homotopy equivalent 4-manifolds