Estimating a treatment effect in survival studies in which patients switch treatment