  We discuss the acceleration and escape of secondary cosmic-ray (CR) nuclei,
such as lithium, beryllium and boron, produced by spallation of primary CR
nuclei like carbon, nitrogen, and oxygen accelerated at the shock in supernova
remnants (SNRs) surrounded by the interstellar medium (ISM) or a circumstellar
medium (CSM). We take into account the energy-dependent escape of CR particles
from the SNR shocks, which is supported by gamma-ray observations of SNRs, to
calculate the spectra of primary and secondary CR nuclei running away into the
ambient medium. We find that if the SNR is surrounded by a CSM with a wind-like
density distribution (i.e., $n_{\rm CSM}\propto r^{-2}$), the spectra of the
escaping secondary nuclei are harder than those of the escaping primary nuclei,
while if the SNR is surrounded by a uniform ISM, the spectra of the escaping
secondaries are always softer than those of the escaping primaries. Using this
result, we show that if there was a past supernova surrounded by a dense
wind-like CSM ($\sim 2.5\times 10^{-3}M_{\odot}~{\rm yr}^{-1}$) which happened
$\sim 1.6\times 10^5~{\rm yr}$ ago at a distance of $\sim 1.6~{\rm kpc}$, we
can simultaneously reproduce the spectral hardening of primary and secondary
CRs above $\sim 200~{\rm GV}$ that have recently been reported by AMS-02.
