A passenger train has caught fire in South Africa after colliding with a truck, killing at least 18 people and injuring 268, rescue workers say.