We should meditate upon all ending of life, including the termination of the aggregates conventionally called 'me' & 'you'. For example, meditation upon death should also be done towards cute little children.
As for being "thankful", this is morally inappropriate and shows the mind is unable to truly let go and enter into the Emptiness of impermanence. Being "thankful" is similar to wanting to drink champagne at a funeral.
This said, meditating on the death of a friend is not selfish. It is reality. The scriptures instruct:
Bhikkhus, there are these five themes that should often be reflected upon by a woman or a man, by a householder or one gone forth. What five? (1) ‘I am subject to old age; I am not exempt from old age.’ (2) ‘I am subject to illness; I am not exempt from illness.’ (3) ‘I am subject to death; I am not exempt from death.’ (4) ‘I must be parted and separated from everyone and everything dear and agreeable to me.’ (5) ‘I am the owner of my kamma, the heir of my kamma; I have kamma as my origin, kamma as my relative, kamma as my resort; I will be the heir of whatever kamma, good or bad, that I do.’
And what may be said to be subject to death? Wife and children are subject to death, men and women slaves, goats and sheep, fowl and pigs, elephants, cattle, horses, and mares are subject to death. These acquisitions are subject to death; and one who is tied to these things, infatuated with them, and utterly committed to them, being himself subject to death, seeks what is also subject to death.