Why contact nos are getting transferred from my old L phone 3 to my iPhone 5s

When I bought iPhone 5s two years back I gave away my unused iPhone 3 to my friend removing the sim which I inserted into my iPhone 5s . To my surprise though sim is removed, the contact numbers my friend storing in the old iPhone 3 which I gave him are also appearing in my iPhone 5s , causing confusion. Pl say why it's happening and how I can stop it.
Does it also happen my number also go into his phone
Did you sign it in to your apple account? If so then it is syncing via iCloud and your friend will also have all your contacts on the old phone too.

You need to sign it out of your iCloud account

Original thread: https://forums.imore.com/threads/why-contact-nos-are-getting-transferred-from-my-old-l-phone-3-to-my-iphone-5s.381512/