I'm working on IFR right now. According to my CFII, the safety pilot can log the entire flight total time (in the category and day/night), and the actual time that your friend is under the hood you can log as PIC. As for cross country, if it is a cross country then I think you get cross country time as well. If this is correct, here's how you could log it:
It's a cross country flight and the round trip is 3 hours. Your friend logged 2.7 hours on the hood. I believe you could log it as:
Total time: 3.0
PIC: 2.7
SEL: 3.0
Day: 3.0
XC: 3.0
PIC XC: 2.7
I think thats they way you'd do it.