This paper proposes a novel method to identify and estimate the parameters of interest in the popular so-called linear-in-means regression model in situations where initial randomization of peers induces the observed network of interest. We argue that initially randomized peers do not generate social effects. However, after randomization, agents can endogenously form relevant connections that can create peer influences. We introduce a moment condition that aggregates local heterogeneous identifying information for all agents in the population. Assuming psi-dependence in the endogenous network space, a Generalized Method of Moments (GMM) estimator is then proposed that is shown to be consistent, asymptotically normally distributed, and also easy to implement using widely used existing statistical software because of its closed form definition. Monte Carlo exercises confirm the good small-sample performance of the proposed GMM estimator, and an empirical application using data from high-school students in Hong Kong finds strong positive spillover effects of math test scores among study partners in our sample, assuming that their observed seatmates were exogenously assigned by their teachers.