Dozens of tourists were rescued after being trapped overnight in a cable car on the Italy-France border.