Research has shown that because of the perspective-taking that gratitude requires, children younger than the age of 7 do not reliably understand that gratitude requires giving credit to others for positive outcomes that happen to the self.

Robert A. Emmons, Thanks! How the New Science of Gratitude Can Make You Happier