You not calling, as a friend, can actually compound the grief and loss they are feeling. Just pick up the phone, even if you get it wrong, just have a conversation and do your best. Your friend with cancer is still the same person they were before.
No matter what you say to someone whose parent or loved one died, it should be derivative of the same goal: communicating empathy and offering assistance, understanding what a person might need from you, and knowing how to phrase sentiments the right way.
There are various developmental theories that go into the tool kit that parents and educators utilize to help mold caring and ethically intact people, including those of Swiss psychologist Jean Piaget and American psychologist Lawrence Kohlberg.