It was fun talking with my friends.

Literal

Friend [with-と] talk [nominalizer-の] [subject-が] was-fun.

のが楽しかった uses の to nominalize 話す, then が marks the nominalized phrase as the subject of 楽しかった. A clean, common pattern: [verb-の]が[adjective] = 'doing X is/was [adjective].'