Everyone's got their own definition of "selling out." For me, it's all about expectations. If people are early to follow a band, they are wary of any changes in style, and resent their newer style becoming popular. See Green Day and a million others.
If a band came out and made it known that they were going to the top of the world, and it didn't matter how they got there, then by definition they couldn't "sell out" since it was their plan all along. It's the bands that are very musically unique, very intimate with their fans, and very humble when they enter the scene that have potential to sell out. I hated when Dashboard, He Is We, and others went away from acoustic...their unique sound. I hated when Fall Out Boy stopped writing songs with built in singalongs giving you the vibe that you were in a small club with them while listening to an album. I hate when bands that belong in small clubs start playing arenas and stadiums and even if I could afford a ticket, it'd be 1/10 of the experience it used to be.
Good topic though, intrigued to see some opinions on here.
I don't think writing a song for another artist is considered to be selling out. The musician is merely expanding what he can do with his/her talent. However, I feel that a completely drastic change in sound or image for that musician's project can be considered selling out. Basically what Thomas said.
But just doing something as simple as changing their sound, even if their intentions weren't to go to the top, that's not selling out? For example, Saves The Day, they were a strict pop-punk band for years and then they branched out to involve indie elements to their music. Yet their far from selling out because they still open for other bands, they're not on the radio, or the top of the charts. I think as long as they are happy playing what their making and it doesn't compromise who they are or what their goals are, then that's not selling out