We use the past perfect tense (had eaten) when a past action occurs before (or leads up to) another past action.