An arms race between producers and scroungers can drive the evolution of social cognition.