I wonder you needed to ask!
Of course you should never take a child of two near any household pet that cannot be trusted not to snap, scratch or bite.
Explain politely to your friend that you will be happy to visit on your own, but you cannot risk bringing a small child into a house where a normally placid dog has started snapping and even has bitten its owner.
Your grandchild would most likely be scared of dogs for life, if the dog snapped or bit, and it is not fair to the animal either, if the owner does not take steps to find out what is wrong.
Something is troubling the dog - a bad tooth, deafness or having had a fright of some sort. A visit to the vet is obviously indicated, so suggest it, if your friend has not already made an appointment.