You somewhat have to. There are personal good and common good. Common good is above personal good. The same applies to the Church. For Christians, the same. You may get some personal good by shunning evil in all its forms yet see to it you never hinder the Church in her reaching to everybody, which is common good.
For example, the Church instructs us to fast during Lent provided your fast goes not against common good. If a Catholic invites you to a party you have to rebuke them fraternally, so the Church through your person will reach this Catholic and wake up his conscience. Be it a heathen and you put them off - they may in sorrow think ‘Sure the Church is joy’s foe and only leads men away from life. Better keep myself away from all those Catholics!’ so you will hinder the Church. This is the Apostles’ teaching.
Of course, it is necessary to discern well when yes is the right answer and when no. Usually, in such tricky cases, no is to whatever will make you sin, because, firstly, good hardly justifies evil, secondly, it will make them shun not one’s ascetism but hypocrisy, which heals long if ever. Like taking part in an orgy Max Mosley style. If no sin is expected you still need to fine-discern the whole thing.
In your case, partying with Masons is simply unpleasant, hardly sinful. Before assessing how your presence will add to the good of the Church, think how much your faith-motivated absence, given he is your good friend, can damage his perception of the Church. Now, I believe you both are smart and understanding and that you can express your position to him well enough for him to get it right, but never underestimate a negative feeling, which some would say is in the unconscious, that your friend may begin to link to Roman Catholicism.
Go, have fun, talk to people because you are not doing anything wrong. Let them know you are a good person. Make friends. Be easy. But remember, the Christian is always on a mission. And when in action, that better to quit than to ruin the whole campaign, I mean, let no one outsmarten you. I mean, don’t preach there if you are not sure you can convert the whole loge, but never forget that tha Masons are also souls in need. They need help but shun medicine. So be careful, watchful, as always.
Hope they’ll be a good family.