Why do we eat cake when there's a party?

From birthdayparty to wedding.

NTR

If there's something to celebrate, people often eat cake. For example on your birthday or at a wedding. But why do we actually eat cake?