Stochastic theory of two-species cooperation