Hair ball problems with cats...

My friend is having a problem with her cat over licking herself. I know what is probably going on here, but the cat just about died bringing up a hairball that was a about 5 inches long and matted. She passed out from it and her owner pulled it out for her. There was blood on it as well. Has anyone delt with this before and have any recommendations?