What mariusafa said is correct, but I wanted to point out that objects in space do not freeze immediately. Dissipation via blackbody radiation is much slower than convection and it can take a long time for something to cool down without the latter. In other words, a vaccuum does function as a very effective insulator, which can sometimes make it more challenging to get rid of heat in space than it is to keep something warm. The ISS, for example, needs to use radiators to keep cool. The same goes for many (most? all?) satellites that are at least as close to the sun as the earth.
What mariusafa said is correct, but I wanted to point out that objects in space do not freeze immediately. Dissipation via blackbody radiation is much slower than convection and it can take a long time for something to cool down without the latter. In other words, a vaccuum does function as a very effective insulator, which can sometimes make it more challenging to get rid of heat in space than it is to keep something warm. The ISS, for example, needs to use radiators to keep cool. The same goes for many (most? all?) satellites that are at least as close to the sun as the earth.