  We study the evolution of embedded clusters. The equations of motion of the
stars in the cluster are solved by direct N-body integration while taking the
effects of stellar evolution and the hydrodynamics of the natal gas content
into account. The gravity of the stars and the surrounding gas are coupled self
consistently to allow the realistic dynamical evolution of the cluster. While
the equations of motion are solved, a stellar evolution code keeps track of the
changes in stellar mass, luminosity and radius. The gas liberated by the
stellar winds and supernovae deposits mass and energy into the gas reservoir in
which the cluster is embedded. We examine cluster models with 1000 stars, but
we varied the star formation efficiency (between 0.05-0.5), cluster radius
(0.1-1.0 parsec), the degree of virial support of the initial population of
stars (0-100%) and the strength of the feedback. We find that an initial star
fraction $M_\star/M_{\rm tot} > 0.05$ is necessary for cluster survival.
Survival is more likely if gas is not blown out violently by a supernova and if
the cluster has time to approach virial equilibrium during out-gassing. While
the cluster is embedded, dynamical friction drives early and efficient mass
segregation in the cluster. Stars of $m \gtrsim 2\,M_\odot$ are preferentially
retained, at the cost of the loss of less massive stars. We conclude that the
degree of mass segregation in open clusters such as the Pleiades is not the
result of secular evolution but a remnant of its embedded stage.
