I confess – I love hugging dogs as much as the next human. Of the three Miller dogs, two love to be hugged (Kai the Kelpie and Bonnie the Scorgidoodle), while Lucy the Corgi, has made her no-hugging preferences abundantly clear with avoidance behaviors, so I don’t even try. If we didn’t have at least one dog who loved hugs, I might need to teach one to at least tolerate them.
This process involves either classical conditioning (giving a puppy a positive association with something she doesn’t already have an opinion of), or classical counter-conditioning (giving a dog a new association with something she already has a negative opinion of). Either way, the process is similar, but it may go slower if you are working to change an existing opinion rather than simply installing one where none previously exists.