I am a speech pathologist, and I work in the public schools. At your son's age, that sound error substitution is very common. It is called "fronting" the back sounds. It is considered a developmental (i.e. normal) error, because kids are not expected to master those /k/ and /g/ (back sounds) until around age 4. In the schools, we qualify kids for speech therapy for those sounds when they are age 5, or one year delayed from the developmental norms. Don't worry about it, just repeat the words back to him in the correct way. Don't ask him to try again or repeat you, just make sure he is hearing a correct model.
Your friend's daughter, on the other hand, should have gotten those sounds by age 5, and should probably have an evaluation. If you have an open-enough relationship with her parents, though, you might suggest she try some oral-motor techniques to train the back of the tongue to raise, rather than the front of the tongue (as in "tat" for "cat). Hold down the front of the tongue with a spoonful of peanut butter, toothbrush while brushing before bed, or some other yummy food, and see if she can say those sounds by themself, and then move on to words: "cat," "car," "game" or whatever /k/ or /g/ words with the back of the tongue instead of the front. Make it fun. If it is too difficult, she may want to seek an evaluation due to the lack of stimulability.
Good luck!