I tried to perform a factory reset on my phone to give it to a friend of mine. However, I realised that when I installed Whatsapp, I can still have my chats, my photos and songs aren't deleted as well. What is wrong with this?
It looks like your
/sdcard partion is not getting wiped. You need to specify more information but I'm assuming you're using a Custom Rom or at least, a Custom recovery. A stock recovery will as far as I know wipe
/sdcard too. Only a Custom ROM by default wouldn't do so. So there's nothing unordinary here. Boot into recovery (I can't tell how since you didn't mention your phone's model) and you can use the options there to wipe any partion you want.
Maybe because there's cloud backup? See, what will happen if after a factory-reset, a whatsapp messenger with different account is installed? What will happen to our conversations? (assuming there's no cloud backup)