QOF deferral recognition in ESBT trust from S corp gain with capital loss carryovers
Trying to sort out QOF deferral recognition in ESBT trust from S corp gain with capital loss carryovers and hitting a wall. Background: I'm trustee of an ESBT that holds S corp stock. The S corp sold an asset in 2024 and the gain passed through on the K-1, box 8a (net long-term capital gain). Some portion of that was originally deferred into a QOF back in 2021 and is now being recognized because we crossed the 5-year mark plus the inclusion event rules. The trust also has capital loss carryovers from prior years sitting at the S portion level. I ran the numbers three different ways and keep getting a different answer each time on whether the loss carryovers offset the recognized QOF gain before or after it hits the QOF inclusion calculation. Can't find clear guidance on the sequencing. What's the right order of operations here?