My first idea was to proceed in a step-wise calculation: first determine the temperature of the planet given its distance from the star, and then add the effect of the atmosphere.
This seems to be also the approach given here, from where I will quote the most relevant parts.
The first key idea is that hot objects lose heat faster than cold objects. This is obvious from everyday experience (you can feel the heat coming from a fire). Detailed observations show that the rate of heat loss is very sensitive to temperature -- specifically, if the temperature is doubled (on an absolute scale), the rate of heat loss is not twice as high -- it is sixteen times as high.
The second key idea is that planets are near an equilibrium where heat lost to space almost exactly equals sunlight gained. Because hot objects lose heat rapidly, they tend to cool off if they have no energy source to maintain their temperature. On the other hand, because cold objects only lose heat slowly, they tend to warm up in the presence of energy sources. In both cases, the objects converge toward a condition where they lose heat at exactly the same rate that it is supplied by energy sources. In the case of planets, the energy source is sunlight.
Let's see how this works for a planet with no atmosphere. At the position of Earth, the absorbed sunlight is $240 \ W/m^2$. In equilibrium, this means that the planet would lose heat to space -- as infrared radiation -- also at a rate $240 \ W/m^2$. How can we calculate the temperature from this? Detailed measurements show that, mathematically, the relationship between heat loss and temperature can be described by the equation $F = \sigma T^4$, where F is the rate of heat loss (the "heat flux") and $\sigma$ is a fundamental physical constant (called the Stephan-Boltzmann constant) with a value of $5.67 \cdot 10^{-8} W/m^2 K^4$. We can rearrange this equation to state that, for a planet with no atmosphere,
$T = (F/\sigma)^{1/4}$.
Plugging the values above, for Earth we find that T=255 K, or -18 C.
How does having an atmosphere with greenhouse gases affect this situation? The greenhouse effect only works if the atmosphere is transparent to sunlight but opaque to infrared (heat) wavelengths. Many gases -- CO2, water vapor, methane -- behave just this way. These are the greenhouse gases.
In this case, the Earth still gains $240 \ W/m^2$ from the sun. It still loses $240 \ W/m^2$ to space. However, because the atmosphere is opaque to infrared light, the surface cannot radiate directly to space as it can on a planet without greenhouse gases. Instead, this radiation to space comes from the atmosphere.
However, atmospheres radiate both up and down (just like a fire radiates heat in all directions). So although the atmosphere radiates $240 \ W/m^2$ to space, it also radiates $240 \ W/m^2$ toward the ground! Therefore, the surface receives more energy than it would without an atmosphere: it gets $240 \ W/m^2$ from sunlight and it gets another $240 \ W/m^2$ from the atmosphere -- for a total of $480 \ W/m^2$ in this simple model.
Now like the atmosphere, the Earth's surface is near an equilibrium where it gains and loses energy at almost the same rate. Because the surface gains $480 \ W/m^2$ (half from sunlight and half from the atmosphere), it also must radiate $480 \ W/m^2$. Unlike the atmosphere, however, the ground can only radiate in one direction -- upward. Thus, the surface radiates $480 \ W/m^2$ upward, and because the atmosphere is opaque to this infrared light, it is absorbed by the atmosphere rather than escaping to space. Notice that the atmosphere, the surface, and the planet as a whole each gain energy at exactly the same rate it is lost.
Some key points to keep in mind:
The greenhouse effect is NOT a situation where "heat is trapped and can't escape." The above calculation makes clear that the opposite is true: the greenhouse effect is how the atmosphere adjusts so that it CAN lose heat when greenhouse gases are present in the atmosphere. About the same amount of heat escapes to space regardless of whether a greenhouse effect exists.
In our simple model, we predicted an elevation in surface temperature of 48oC (86oF). This is an overestimate. On the real Earth, the current average surface temperature is 288 K (59oF), not 303 K, so the actual greenhouse effect causes a warming of only 33oC (59oF) relative to an atmosphere without a greenhouse effect. Thus, the crude model presented here overestimates the strength of the greenhouse effect by 50%. This discrepancy is caused by several factors that we neglected. For example, some sunlight is absorbed in the atmosphere rather than at the surface, and some infrared radiation from Earth's surface can escape to space rather than being absorbed in the atmosphere. These effects are all included in real climate models. Properly taking these effects into account would lead to a predicted temperature much closer to the actual temperature.
An increase in the abundance of CO2, water vapor, methane, and other greenhouse gases causes a decrease in the fraction of infrared radiation from the surface that can escape to space. This forces the surface temperature to increase as the Earth strives to reach the new equilibrium. More greenhouse gases mean a stronger greenhouse effect and a hotter planet.
We can again use the simple expression $T = (F/\sigma)^{1/4}$ to calculate the temperature of the surface. Using F = $480 \ W/m^2$, we find that T=303 K, which corresponds to 30 C.
When the greenhouse gas abundance is increased, it takes time for the system to warm to the new equilibrium temperature. During these times, the Earth absorbs slightly more sunlight than it loses heat, which is what allows the warming. Thus, during these times, the Earth is slightly out of equilibrium. What this means is that even if the abundances of greenhouse gases became constant right now, the Earth would continue to warm by another 0.5-1C over the next 50-100 years as it reached the new equilibrium temperature. This delayed warming has already been caused and is unavoidable. Of course, additional warming will occur if greenhouse gas abundances continue to increase.