If the CD is just a regular burned audio CD then you have to do it manually.
The way it normally works is that the CD publisher publishes all the track names and lengths and album name and length to a special online database; the combination of all the track lengths and album length give the CD a (usually) unique signature. When you pop a published CD into your audio software (itunes) it only knows the lengths of the tracks and the album, but it then looks these numbers up in the online database, and finds out what the album and track names are, and automagically it updates your library with the (usually) correct names for all the songs.
Since the CD you have is not something that was published, there is no way for your audio software to get the names automatically.
This all goes out the window if you have a CD with music in MP3 or similar format since those formats can be made to remember what all the track info is. So next time you want some music from your friend, ask for MP3 or better.