Sigmund Freud

When it happens that a person has to give up a sexual object, there quite often ensues an alteration of his ego which can only be described as a setting up of the object inside the ego, as it occurs in melancholia; the exact nature of this substitution is as yet unknown to us.