The effect of surfaces on the optical properties of GaAs nanowires is evidenced by comparing nanowires with or without an AlGaAs capping shell as a function of the diameter. We find that the optical properties of unpassivated nanowires are governed by Fermi-level pinning, whereas, the optical properties of passivated nanowires are mainly governed by surface recombinations. Finally, we measure a surface recombination velocity of 3 x 10(3) cm s(-1) one order of magnitude lower than values previously reported for (110) GaAs surfaces. These results will serve as guidance for the application of nanowires in solar cell and light emitting devices.