Sonic met Miles "Tails" Prower in 1992, in Sonic the Hedgehog 2.
Tails made his debut there as a two-tailed fox who could follow Sonic's lead, and in the game's second-player mode he was the one your friend controlled. He has been Sonic's closest companion ever since.