How can friend log on to a Minecraft server as a guest?

There's no way to log into a minecraft server as a guest. You have to purchase the game to be able to use minecraft online "legally". The only way you can play with a non-purchased account is by illegally playing on a cracked minecraft client. Which is strictly unreccomended.