I wasn't talking about saving a life. You don't operate just because the patient wants to. You wouldn't amputate a patient because they wanted to. You would if it would salvage the remainder of the limb and prevent complications
and the patient wants to. Remember, for a patient to have treatment there must be three conditions (that I can think of): the patient consents to treatment, the doctor is happy to carry out the treatment, and there is a medical basis for doing so.
The consent issue depends on whether the patient has capacity - ie they can demonstrate that they understand the treatment, risks/benefits and can express it. If the patient lacks capacity (eg Alzheimers dementia), the doctor can then consent on behalf of the patient. The family's wishes are taken into consideration but not necessarily followed.