Apple is tough when it comes to devices such as it doesn’t allow you to install application unless you Jailbreak your iPhone or the application is approved in iTunes library. Same way every iPhone is associated with just one iTunes library which is generally on your computer. This restricts for you to sync your iPhone music with somebody elses library. I guess this has to do something with Music piracy.
Phoneable is a free app which helps you getting over this by setting your iPhone key with iTunes library key every time you switch computers.
It first backups your iPhone library key, set the current iTunes library key with your iPhone Library key and then check if you can copy. This tool now makes it possible to play music which your friend has bought on his iTunes to get synced with your iPhone. Right ? Download PhoneAble