If the CD actually has HP on the label, it may not install.
In my mind however, the bigger issue is the legality of installing someone else's OEM version of Windows on your system.
Read the Windows OEM End User License Agreement closely.
You will discover that OEM versions of Windows are licensed ONLY to the original user on the specific hardware that the OEM version of Windows came with.
Further, if your friend was running XP on his HP system and had it activated and registered, you may not be able to activate it on your system.
The better way to go for a system you build yourself is to purchase a generic OEM copy of XP from your hardware supplier.
Many computer parts sellers will sell you an OEM copy of XP along with specific hardware purchases.
Another thing to keep in mind with OEM software is that the software manufacture does NOT provide support for OEM versions.
Chas