Dynamics of beneficial epidemics