To frost a cake in a pan, cool it completely first. Otherwise, any residual heat will melt the buttercream or your frosting of choice. For best results, wrap the pan well and chill (or freeze). This step isn't imperative but will help keep crumbs intact as you spread the frosting on top. Once your cake is cool, dollop enough frosting to create a nice half-inch layer on top, and spread it evenly with a small offset spatula or the back of a spoon.