Deformation of two-phase materials: a model based on strain compatibility