Birthday cakes can be bought from the Misc > Party section of Buy mode. They are used to age Sims (except young adults and elders) to the next life stage, but can only be used if the Sim is within 24 game hours of transitioning.