A general approach for cure models in survival analysis