I’m very sorry about your friend.
CPR keeps the blood flowing enough to keep the brain and vital organs alive until the heart can be restarted with meds or a pacemaker or by correcting whatever made it stop in the first place. If the heart has a significant blockage, blood can’t get to part of the heart muscle even with CPR, and if too much heart muscle dies, there’s just nothing that can be done. Even a bypass can’t bring dead heart cells back to life.
He appeared to be brain dead when we saw him in the hospital, but since I wasn’t direct family, I’m not positive about everything the docs said. It was very sad, would maybe have been less so if he had died and not been in the hospital for several days before they had to unplug him. I think that’s always difficult.