An extension of de Finetti's theorem