Discovered this on accident today and thought I'd spread the word, though you must have the extra custom class DLC pack. Here's how it works, very simple:
Step 1: Take a weapon you have a max level and set up a class using the attachments you'd like to have. Step 2: Switch class sets and create a class with the max level weapon with no attachments. Step 3: On your 2nd set of classes, where you just created the naked class, prestige your weapon. Step 4: Return to the other class set. You will see that you still have the attachments you selected.
You cannot select other attachments without voiding the ones you have equipped, sadly, but this can work if you don't want to grind your way back to the attachments you like. It will likely be patched soon, so if you want to take advantage of it, feel free. Have fun, GameFAQs.
Soon to be hosting Critical Hit game and movie reviews via YouTube.
It doesn't seem to last forever, I tried this day one, had several 'copies' of a B3R where I'd copied out my main set to set classes up from, prestieged it, found that I had the attachments still, woot!
but, sometime later that night it dissapeared, no big loss as the only attachment was extended mags.. so it won't stay forever (even if you don't change the classes) but it's enough for a few games to earn back some of the initial attachments.