When any freight or baggage comes into possession of a common carrier, and is unclaimed or cannot be delivered, the carrier shall safely keep it as a warehouseman for three months, unless it is perishable or liable to depreciate in value by keeping, and the carrier shall be entitled to a reasonable compensation for storage thereof.