Cheerfullll Said:
"Unable to erase iPhone data: a friend gave me his old iPhone X I tried to erase all data and settings but for many hours now it’s still showing the apple logo and with the loading bar below it (the loading bar is not moving).. I can’t turn off the phone I can’t leave this particular spot… pls what can I do here?"
-------
Properly Giving Away an iPhone:
Give this back to your friend. They need to get back in, and then logout of iCloud, once back in. If your friend never log out of this, then it will be useless to you. So, be certain they perform as instructed here, including the iCloud logout: What to do Before you Sell, Give Away, or Trade In your iPhone or iPad - Apple Support.