For γ∈(0,2), the quantum disk and γ-quantum wedge are two of the most natural types of Liouville quantum gravity (LQG) surfaces with boundary. These surfaces arise as scaling limits of finite and infinite random planar maps with boundary, respectively. We show that the left/right quantum boundary length process of a space-filling SLE16/γ2 curve on a quantum disk or on a γ-quantum wedge is a certain explicit conditioned two-dimensional Brownian motion with correlation −cos(πγ2/4). This extends the mating of trees theorem of Duplantier, Miller, and Sheffield (2014) to the case of quantum surfaces with boundary (the disk case for γ∈(2,2) was previously treated by Duplantier, Miller, Sheffield using different methods). As an application, we give an explicit formula for the conditional law of the LQG area of a quantum disk given its boundary length by computing the law of the corresponding functional of the correlated Brownian motion.