Device for linking two carriages of a train