Il a mangé le gâteau que j’avais préparé hier. He ate the cake that I had prepared yesterday.
As you notice there are two actions in the sentence above: “manger” and “préparer”. Both actions happened in the past, but one happened before the other. The action that happened before is expressed by the plus que parfait tense, whereas the second action is expressed in this sentence by the passé composé.
We use the plus que parfait in the following cases: