Your friend let this person stay for how long? Does this person receive mail at the apartment? Contribute toward any bills? Pay for any services, such as cable or Internet?
The fastest way to find out if "this is something that has to go to court" is often to contact the local police (not by 911, but in person or over a non-emergency line) and ask if they'll remove the person as a trespasser. If so, he's out (although that doesn't necessarily mean you can't be sued if it turns out to be a violation of eviction laws). If they say "it's a civil matter", you have to go to court.

