To answer your question frankly, it does not work like that at all. (or maybe sometimes).
So you need to be more explicit with your description of "all strings" and "fingers on some frets".
A major chord is the same on all instruments, it is the combination of 1, 3, 5 notes of the major scale. If your friend fingered three and only three notes for a Gb major chord in standard tuning and played all strings it may sound really cool, but it would not sound like a Gb major chord.
The compatibility of the other strings with a given three note chord depends on a few factors.
1) we usually double notes, like the 1 and the 5. Even in 4 voice harmony theory we are taught to double notes. So if your friend is playing a bar chord in standard tuning then no harm no foul, all the notes are part of the chord. For example, a Major chord in bar chord form is voiced (1, 5, 1, 3, 5, 1), spanning 2 octaves. You have three occurrences of the 1 and 2 of the 5. You can do this on the piano by the way. Voicing refers to the ordering of notes.
2) if your friend and you are playing songs in a key that is referred to in guitar speak as "an open string key" (i.e. a key that is compatible with open string notes) then he/she can freely play open strings along with the notes of a chord and they will either be part of the chord or a compatible extension of the chord, so it will sound pleasing.
3) your friend may have tuned the guitar differently compared to standard tuning, allowing them to strum open strings as they play chords.
It is actually not typical for a guitarist to strum ALL strings even when playing in open string keys with open string chord forms. A typical example is a dominant 7th chord. The bar chord form is voiced (1, 5, 7, 3, 5, 1) using all 6 strings. A more typical voicing in jazz is (1, x, 7, 3, 5, x) where x means don't play. Now the guitarist can play the chord finger style with the right hand or "mute" the unwanted notes by gently draping the left hand fingers over the strings that should not be heard. In this way they can appear to "strum" all strings but are really playing only the 4 they want.
So, in general one does not play all the strings all the time, but you can see that in some cases it's okay. Those cases are limited and it is no surprise that much of classical guitar music (or guitar music in general) is written in what I call open string keys (hence, my comment maybe sometimes). Jazz guitarists get used to playing in Bb and Eb which do not lend themselves to open string voicing (at least not easily and not over a large number of chords in the key).