E.T.
I have left frosted cake out for a week and even a little longer. My husband's birthday cake had cream cheese frosting. We kept it on the counter all week and no one got sick from eating it. Keep the cake covered so it doesn't dry out. But you also don't want to seal it too tight if it is moist. It will get sticky and the frosting will start to melt. I will usually stick toothpicks or even thin wooden skewers into the cake and then drape plastic wrap or Glad Press and Seal over the toothpicks and loosely seal it to whatever the cake is sitting on. If holes are left in the frosting, just use a knife to smooth them over. As long as it doesn't get too hot or too moist it can sit out even overnight and still look and taste good and be safe to eat.