This answer applies to American practice. American freight trains do not have sleeping quarters. In the past (mostly ending in the 1980s) each freight train had a caboose on the rear end. This was basically an office but could have bunks and a stove that could be used for cooking.