According to the second law of thermodynamics which is a requirement for thermal energy to flow from colder objects to hotter objects?

Heat will flow naturally from hotter objects to colder objects. To flow the other way, from colder objects to hotter objects, requires energy to be used.