I saw a related question on Parenting, but this one is different, since it's a) about older children and b) not your own child.
Disclaimer: This is based on the experience of a friend - I will call him Bob. However, I was present and it got me thinking.
Situation
A social event with many activities for people of all ages. Chess was among them, staffed with good, amateur club players like Bob (no Bobby, though). A family strolled by and asked if their son could play. For sure, Bob was willing. Please note, that he neither knew the child, nor the family.
The child was between 5 and 7 years old. Also, the child was interested in chess, but not a wunderkind (beginner level, not yet fully acquainted with the rules of the game), so it became a rather one-sided affair. The parents were not present, and came back later.
Question
How do you best approach such a game?
Goal: The game shall be a good experience for the child.
This especially from the perspective of someone, who is not good at interacting with smaller children (a bit reminiscent of bit reminiscent of that question). And when the game in question hardly involves luck. The question is not restricted to chess, you may also think of Go or something else, hence the generic question.
Bob's approach:
It was just one game. After repeating some of the important rules, Bob tried to neither let the child win, nor did to give his best. When the child seemed to get bored, he wrapped up the game.