You would first need to find out if your friend is eligible for a liver transplant. Some patients with certain types of cancers, especially ones that have spread outside the liver, cannot receive transplants because replacing the liver with a transplant will not cure their cancer. When you find out if your friend is eligible to receive a transplant then you can begin your research into becoming a possible donor. There would be tests to make sure you are compatible in blood types and size and of course to make sure you are healthy enough to undergo a very risky elective surgery.
You can read more about liver donation on this forum. This is very different than kidney donation. While the liver does regenerate unlike a kidney, the surgery itself comes with more risks and greater recuperation time. Good luck on your journey. Wishing your friend a complete recovery.
Sherri